# -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
File    : Send MQ tools.py
Time    : 2023/8/9 9:57
author  : mojin
Email   : 397135766@qq.com
-------------------------------------------------------------------------------
"""
import os
import sys
from PyQt5 import QtCore, QtWidgets,uic

from common.parameter_settings import ParameterSettings
from common import qt_message
from common.logger import Logger
from MqSending.MqSending import MqSending


class ComputingEquipment(MqSending):


    def __init__(self,):
        self.ui = uic.loadUi("./design_ui/send_mq.ui")
        super().__init__(self.ui)
        #super().__init__(self.ui)
        # super().__init__(self.ui)


        self.MqSending_setupUi()


        self.cwd = os.getcwd()  # 获取当前程序文件位置
        self.execute_stop=False
        self.pdf_to_word_complete = True
        self.window_name='Send MQ tools'
        self.version='V1.0.0'

        self.default_dir = QtCore.QStandardPaths.standardLocations(QtCore.QStandardPaths.HomeLocation)[0]

        self.computing_setupUi()



    def computing_setupUi(self,):

        self.ui.setWindowTitle(f"{self.window_name} {self.version}")# Conversion tool V1.0.0.202308111449
        #执行跳转参数执行界面
        self.ui.actionshanc.triggered.connect(self.show_about_dialog_parameter_settings) #show_about_dialog
        # 设置属性，以便保持窗口活跃
        self.parameter_settings = None

        # 执行跳转关于版本
        self.ui.actionguanyuanbb.triggered.connect(self.show_about_dialog)
        self.ui.menu.addAction(self.ui.actionguanyuanbb)


    def show_about_dialog(self):
        qt_message.message(QtWidgets,'版本号', f"{self.window_name} {self.version}", fun='about')

    def show_about_dialog_parameter_settings(self):#参数配置

        if not self.parameter_settings:
            self.parameter_settings = ParameterSettings()
        self.parameter_settings.ui.show()



if __name__ == "__main__":
    from PyQt5.QtGui import QIcon
    app = QtWidgets.QApplication(sys.argv)
    app.setWindowIcon(QIcon('images/icon16.ico')) #images/icon16.ico
    w = ComputingEquipment()
    # 展示窗口
    w.ui.show()

    app.exec()

